const express = require("express");

const path = require("path");

const app = express();

app.set("view engine", "ejs"); //设置模板引擎

app.set("views", path.resolve(__dirname, "./views"));

app.get("/home", (req, res) => {
  //render响应
  // res.render('模板文件命名', '数据')
  let title = "testa";
  res.render('home', {title})
});

app.listen(3000, () => {
  console.log("服务已启动");
});
